home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_5 / issue_11 / hints / numtostr < prev    next >
Unknown  |  1992-07-02  |  2.2 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text


This file was not able to be converted.
This format is not currently supported by dexvert.

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert Truevision Targa Graphic (image/tga) magic Supported
100% file data default
100% xdgMime image/x-tga default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 0d 00 0a 69 f4 20 3e 4e | 75 6d 54 6f 53 74 72 20 |...i. >N|umToStr |
|00000010| 2d 20 75 73 69 6e 67 20 | 69 6e 74 65 67 65 72 73 |- using |integers|
|00000020| 20 26 20 73 74 72 69 6e | 67 73 20 74 6f 20 61 76 | & strin|gs to av|
|00000030| 6f 69 64 20 72 6f 75 6e | 64 69 6e 67 20 65 72 72 |oid roun|ding err|
|00000040| 6f 72 73 20 28 63 61 6c | 6c 20 50 52 4f 43 5f 4e |ors (cal|l PROC_N|
|00000050| 54 53 5f 48 65 6c 70 20 | 66 6f 72 20 6d 6f 72 65 |TS_Help |for more|
|00000060| 20 64 65 74 61 69 6c 73 | 29 0d 00 14 38 f4 20 28 | details|)...8. (|
|00000070| 63 29 63 6f 70 79 72 69 | 67 68 74 20 31 39 39 32 |c)copyri|ght 1992|
|00000080| 20 56 69 6e 63 65 20 4d | 2e 20 48 75 64 64 2f 53 | Vince M|. Hudd/S|
|00000090| 6f 66 74 20 52 6f 63 6b | 20 53 6f 66 74 77 61 72 |oft Rock| Softwar|
|000000a0| 65 0d 00 1e 63 f4 20 54 | 68 65 73 65 20 72 6f 75 |e...c. T|hese rou|
|000000b0| 74 69 6e 65 73 20 77 65 | 72 65 20 77 72 69 74 74 |tines we|re writt|
|000000c0| 65 6e 20 62 79 2c 20 61 | 6e 64 20 61 72 65 20 63 |en by, a|nd are c|
|000000d0| 6f 70 79 72 69 67 68 74 | 65 64 20 74 6f 2c 20 56 |opyright|ed to, V|
|000000e0| 69 6e 63 65 20 4d 2e 20 | 48 75 64 64 20 61 6e 64 |ince M. |Hudd and|
|000000f0| 20 53 6f 66 74 20 52 6f | 63 6b 20 53 6f 66 74 77 | Soft Ro|ck Softw|
|00000100| 61 72 65 2e 0d 00 28 62 | f4 20 48 6f 77 65 76 65 |are...(b|. Howeve|
|00000110| 72 2c 20 64 75 65 20 74 | 6f 20 74 68 65 69 72 20 |r, due t|o their |
|00000120| 6e 61 74 75 72 65 20 74 | 68 65 79 20 61 72 65 20 |nature t|hey are |
|00000130| 66 72 65 65 6c 79 20 75 | 73 61 62 6c 65 20 62 79 |freely u|sable by|
|00000140| 20 61 6c 6c 2e 20 54 68 | 65 20 6f 6e 6c 79 20 72 | all. Th|e only r|
|00000150| 65 73 74 72 69 63 74 69 | 6f 6e 73 20 62 65 69 6e |estricti|ons bein|
|00000160| 67 20 74 68 61 74 0d 00 | 32 63 f4 20 74 68 65 73 |g that..|2c. thes|
|00000170| 65 20 52 45 4d 20 6c 69 | 6e 65 73 20 72 65 6d 61 |e REM li|nes rema|
|00000180| 69 6e 20 69 66 20 74 68 | 65 20 72 6f 75 74 69 6e |in if th|e routin|
|00000190| 65 73 20 61 72 65 20 75 | 73 65 64 20 75 6e 63 68 |es are u|sed unch|
|000001a0| 61 6e 67 65 64 20 61 6e | 64 20 69 6e 20 63 61 73 |anged an|d in cas|
|000001b0| 65 73 20 77 68 65 72 65 | 20 74 68 65 79 20 61 72 |es where| they ar|
|000001c0| 65 20 61 64 61 70 74 65 | 64 0d 00 3c 3a f4 20 6d |e adapte|d..<:. m|
|000001d0| 65 6e 74 69 6f 6e 20 6f | 66 20 56 69 6e 63 65 20 |ention o|f Vince |
|000001e0| 4d 2e 20 48 75 64 64 2f | 53 6f 66 74 20 52 6f 63 |M. Hudd/|Soft Roc|
|000001f0| 6b 20 53 6f 66 74 77 61 | 72 65 20 69 73 20 6d 61 |k Softwa|re is ma|
|00000200| 64 65 2e 0d 00 50 62 f4 | 20 54 68 65 20 72 6f 75 |de...Pb.| The rou|
|00000210| 74 69 6e 65 73 2c 20 61 | 73 20 61 72 65 2c 20 61 |tines, a|s are, a|
|00000220| 72 65 20 6e 6f 74 20 27 | 62 72 69 6c 6c 69 61 6e |re not '|brillian|
|00000230| 74 6c 79 27 20 70 72 6f | 67 72 61 6d 6d 65 64 20 |tly' pro|grammed |
|00000240| 73 69 6d 70 6c 79 20 62 | 65 63 61 75 73 65 20 74 |simply b|ecause t|
|00000250| 68 65 79 20 77 65 72 65 | 20 70 75 74 20 74 6f 67 |hey were| put tog|
|00000260| 65 74 68 65 72 0d 00 5a | 50 f4 20 69 6e 20 61 20 |ether..Z|P. in a |
|00000270| 68 75 72 72 79 2e 20 53 | 6f 20 49 20 64 6f 6e 27 |hurry. S|o I don'|
|00000280| 74 20 77 61 6e 74 20 61 | 6e 79 6f 6e 65 20 70 6f |t want a|nyone po|
|00000290| 69 6e 74 69 6e 67 20 6f | 75 74 20 6d 79 20 62 61 |inting o|ut my ba|
|000002a0| 64 20 70 72 6f 67 72 61 | 6d 6d 69 6e 67 20 68 61 |d progra|mming ha|
|000002b0| 62 69 74 73 21 0d 00 64 | 05 20 0d 00 6e 05 20 0d |bits!..d|. ..n. .|
|000002c0| 00 78 19 f4 20 48 65 6c | 70 20 72 6f 75 74 69 6e |.x.. Hel|p routin|
|000002d0| 65 20 66 69 72 73 74 2e | 0d 00 82 05 20 0d 00 8c |e first.|.... ...|
|000002e0| 10 dd 20 f2 5f 4e 54 53 | 5f 48 65 6c 70 0d 00 96 |.. ._NTS|_Help...|
|000002f0| 05 f1 0d 00 a0 25 f1 22 | 20 2d 2d 20 46 4e 5f 49 |.....%."| -- FN_I|
|00000300| 6e 74 5f 54 6f 5f 53 74 | 72 28 4e 75 6d 62 65 72 |nt_To_St|r(Number|
|00000310| 25 29 20 2d 2d 22 27 0d | 00 aa cb c8 99 22 4f 53 |%) --"'.|....."OS|
|00000320| 5f 50 72 65 74 74 79 50 | 72 69 6e 74 22 2c 22 52 |_PrettyP|rint","R|
|00000330| 65 74 75 72 6e 73 20 61 | 20 74 65 6e 20 63 68 61 |eturns a| ten cha|
|00000340| 72 61 63 74 65 72 2c 20 | 72 69 67 68 74 20 61 6c |racter, |right al|
|00000350| 69 67 6e 65 64 20 73 74 | 72 69 6e 67 20 63 6f 6e |igned st|ring con|
|00000360| 74 61 69 6e 69 6e 67 20 | 61 20 74 77 6f 20 64 65 |taining |a two de|
|00000370| 63 69 6d 61 6c 20 70 6c | 61 63 65 20 6e 75 6d 62 |cimal pl|ace numb|
|00000380| 65 72 20 28 31 2f 31 30 | 30 20 6f 66 20 74 68 65 |er (1/10|0 of the|
|00000390| 20 6f 72 69 67 69 6e 61 | 6c 20 76 61 6c 75 65 29 | origina|l value)|
|000003a0| 2e 20 46 6f 72 20 65 78 | 61 6d 70 6c 65 2c 20 74 |. For ex|ample, t|
|000003b0| 68 65 20 6e 75 6d 62 65 | 72 20 37 35 36 20 77 6f |he numbe|r 756 wo|
|000003c0| 75 6c 64 20 62 65 20 72 | 65 74 75 72 6e 65 64 20 |uld be r|eturned |
|000003d0| 61 73 20 22 22 20 20 20 | 20 20 20 37 2e 35 36 22 |as "" | 7.56"|
|000003e0| 22 22 0d 00 b4 27 f1 27 | 27 22 20 2d 2d 20 46 4e |""...'.'|'" -- FN|
|000003f0| 5f 53 74 72 5f 54 6f 5f | 49 6e 74 28 53 74 72 69 |_Str_To_|Int(Stri|
|00000400| 6e 67 24 29 20 2d 2d 22 | 27 0d 00 be 99 c8 99 22 |ng$) --"|'......"|
|00000410| 4f 53 5f 50 72 65 74 74 | 79 50 72 69 6e 74 22 2c |OS_Prett|yPrint",|
|00000420| 22 52 65 74 75 72 6e 73 | 20 61 6e 20 69 6e 74 65 |"Returns| an inte|
|00000430| 67 65 72 20 6e 75 6d 62 | 65 72 2c 20 31 30 30 20 |ger numb|er, 100 |
|00000440| 74 69 6d 65 73 20 61 73 | 20 62 69 67 20 61 73 20 |times as| big as |
|00000450| 74 68 65 20 6e 75 6d 62 | 65 72 20 70 61 73 73 65 |the numb|er passe|
|00000460| 64 20 61 73 20 74 68 65 | 20 73 74 72 69 6e 67 2e |d as the| string.|
|00000470| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 20 22 22 34 | For exa|mple ""4|
|00000480| 35 2e 34 33 22 22 20 77 | 6f 75 6c 64 20 62 65 20 |5.43"" w|ould be |
|00000490| 72 65 74 75 72 6e 65 64 | 20 61 73 20 34 35 34 33 |returned| as 4543|
|000004a0| 2e 22 0d 00 c8 29 f1 27 | 27 22 20 2d 2d 20 46 4e |."...).'|'" -- FN|
|000004b0| 5f 46 6f 72 6d 61 74 4e | 75 6d 62 65 72 28 53 74 |_FormatN|umber(St|
|000004c0| 72 69 6e 67 24 29 20 2d | 2d 22 27 0d 00 d2 ba c8 |ring$) -|-"'.....|
|000004d0| 99 22 4f 53 5f 50 72 65 | 74 74 79 50 72 69 6e 74 |."OS_Pre|ttyPrint|
|000004e0| 22 2c 22 46 6f 72 6d 61 | 74 73 20 74 68 65 20 6e |","Forma|ts the n|
|000004f0| 75 6d 62 65 72 20 63 6f | 6e 74 61 69 6e 65 64 20 |umber co|ntained |
|00000500| 69 6e 20 74 68 65 20 73 | 74 72 69 6e 67 20 74 6f |in the s|tring to|
|00000510| 20 61 20 31 30 20 63 68 | 61 72 61 63 74 65 72 2c | a 10 ch|aracter,|
|00000520| 20 72 69 67 68 74 20 61 | 6c 69 67 6e 65 64 2c 20 | right a|ligned, |
|00000530| 74 77 6f 20 64 65 63 69 | 6d 61 6c 20 70 6c 61 63 |two deci|mal plac|
|00000540| 65 20 6e 75 6d 62 65 72 | 2e 20 46 6f 72 20 65 78 |e number|. For ex|
|00000550| 61 6d 70 6c 65 2c 20 22 | 22 31 32 2e 35 22 22 20 |ample, "|"12.5"" |
|00000560| 77 6f 75 6c 64 20 62 65 | 20 72 65 74 75 72 6e 65 |would be| returne|
|00000570| 64 20 61 73 20 22 22 20 | 20 20 20 20 31 32 2e 35 |d as "" | 12.5|
|00000580| 30 22 22 2e 22 0d 00 dc | 05 f1 0d 00 e6 05 e1 0d |0""."...|........|
|00000590| 00 f0 05 20 0d 00 fa 15 | f4 20 54 68 65 20 70 72 |... ....|. The pr|
|000005a0| 6f 63 65 64 75 72 65 73 | 2e 0d 01 04 50 f4 20 52 |ocedures|....P. R|
|000005b0| 45 4d 20 6c 69 6e 65 73 | 20 61 72 65 20 6e 6f 74 |EM lines| are not|
|000005c0| 20 75 73 65 64 20 66 72 | 6f 6d 20 68 65 72 65 6f | used fr|om hereo|
|000005d0| 6e 2c 20 61 73 20 66 75 | 6c 6c 20 64 65 74 61 69 |n, as fu|ll detai|
|000005e0| 6c 73 20 61 72 65 20 67 | 69 76 65 6e 20 69 6e 20 |ls are g|iven in |
|000005f0| 74 68 65 20 74 65 78 74 | 2e 0d 01 0e 05 20 0d 01 |the text|..... ..|
|00000600| 18 18 dd 20 a4 5f 49 6e | 74 5f 54 6f 5f 53 74 72 |... ._In|t_To_Str|
|00000610| 28 49 6e 74 25 29 0d 01 | 22 0b ea 20 52 65 61 6c |(Int%)..|".. Real|
|00000620| 24 0d 01 2c 10 49 6e 74 | 25 3d 94 28 49 6e 74 25 |$..,.Int|%=.(Int%|
|00000630| 29 0d 01 36 28 e7 20 49 | 6e 74 25 3c 31 30 20 8c |)..6(. I|nt%<10 .|
|00000640| 20 52 65 61 6c 24 3d 22 | 20 20 20 20 20 20 30 30 | Real$="| 00|
|00000650| 22 2b c3 28 49 6e 74 25 | 29 0d 01 40 33 e7 20 49 |"+.(Int%|)..@3. I|
|00000660| 6e 74 25 3e 3d 31 30 20 | 80 20 49 6e 74 25 3c 31 |nt%>=10 |. Int%<1|
|00000670| 30 30 20 8c 20 52 65 61 | 6c 24 3d 22 20 20 20 20 |00 . Rea|l$=" |
|00000680| 20 20 30 22 2b c3 28 49 | 6e 74 25 29 0d 01 4a 2d | 0"+.(I|nt%)..J-|
|00000690| e7 20 49 6e 74 25 3e 3d | 31 30 30 20 8c 52 65 61 |. Int%>=|100 .Rea|
|000006a0| 6c 24 3d c2 22 20 20 20 | 20 20 20 20 20 22 2b c3 |l$=." | "+.|
|000006b0| 28 49 6e 74 25 29 2c 39 | 29 0d 01 54 21 52 65 61 |(Int%),9|)..T!Rea|
|000006c0| 6c 24 3d c0 52 65 61 6c | 24 2c 37 29 2b 22 2e 22 |l$=.Real|$,7)+"."|
|000006d0| 2b c2 52 65 61 6c 24 2c | 32 29 0d 01 5e 0a 3d 52 |+.Real$,|2)..^.=R|
|000006e0| 65 61 6c 24 0d 01 68 05 | 20 0d 01 72 19 dd 20 a4 |eal$..h.| ..r.. .|
|000006f0| 5f 53 74 72 5f 54 6f 5f | 49 6e 74 28 52 65 61 6c |_Str_To_|Int(Real|
|00000700| 24 29 0d 01 7c 0a ea 20 | 49 6e 74 25 0d 01 86 1f |$)..|.. |Int%....|
|00000710| 52 65 61 6c 24 3d a4 5f | 46 6f 72 6d 61 74 4e 75 |Real$=._|FormatNu|
|00000720| 6d 62 65 72 28 52 65 61 | 6c 24 29 0d 01 90 26 49 |mber(Rea|l$)...&I|
|00000730| 6e 74 25 3d bb 28 c0 52 | 65 61 6c 24 2c 37 29 29 |nt%=.(.R|eal$,7))|
|00000740| 2a 31 30 30 2b bb 28 c2 | 52 65 61 6c 24 2c 32 29 |*100+.(.|Real$,2)|
|00000750| 29 0d 01 9a 09 3d 49 6e | 74 25 0d 01 a4 05 20 0d |)....=In|t%.... .|
|00000760| 01 ae 1d dd 20 a4 5f 46 | 6f 72 6d 61 74 4e 75 6d |.... ._F|ormatNum|
|00000770| 62 65 72 28 4e 75 6d 62 | 65 72 24 29 0d 01 b8 14 |ber(Numb|er$)....|
|00000780| ea 20 4c 65 6e 67 74 68 | 25 2c 50 6f 69 6e 74 25 |. Length|%,Point%|
|00000790| 0d 01 c2 16 4c 65 6e 67 | 74 68 25 3d a9 28 4e 75 |....Leng|th%=.(Nu|
|000007a0| 6d 62 65 72 24 29 0d 01 | cc 18 50 6f 69 6e 74 25 |mber$)..|..Point%|
|000007b0| 3d a7 4e 75 6d 62 65 72 | 24 2c 22 2e 22 29 0d 01 |=.Number|$,".")..|
|000007c0| d6 3b e7 20 28 50 6f 69 | 6e 74 25 3d 4c 65 6e 67 |.;. (Poi|nt%=Leng|
|000007d0| 74 68 25 2d 31 29 20 80 | 20 28 50 6f 69 6e 74 25 |th%-1) .| (Point%|
|000007e0| 3e 30 29 20 8c 20 4e 75 | 6d 62 65 72 24 3d 4e 75 |>0) . Nu|mber$=Nu|
|000007f0| 6d 62 65 72 24 2b 22 30 | 22 0d 01 e0 3a e7 20 28 |mber$+"0|"...:. (|
|00000800| 50 6f 69 6e 74 25 3d 4c | 65 6e 67 74 68 25 29 20 |Point%=L|ength%) |
|00000810| 80 20 28 50 6f 69 6e 74 | 25 3e 30 29 20 8c 20 4e |. (Point|%>0) . N|
|00000820| 75 6d 62 65 72 24 3d 4e | 75 6d 62 65 72 24 2b 22 |umber$=N|umber$+"|
|00000830| 30 30 22 0d 01 ea 1d e7 | 20 4c 65 6e 67 74 68 25 |00".....| Length%|
|00000840| 3d 30 20 8c 20 4e 75 6d | 62 65 72 24 3d 22 30 22 |=0 . Num|ber$="0"|
|00000850| 0d 01 f4 26 e7 20 50 6f | 69 6e 74 25 3d 30 20 8c |...&. Po|int%=0 .|
|00000860| 20 4e 75 6d 62 65 72 24 | 3d 4e 75 6d 62 65 72 24 | Number$|=Number$|
|00000870| 2b 22 2e 30 30 22 0d 01 | fe 24 e7 20 50 6f 69 6e |+".00"..|.$. Poin|
|00000880| 74 25 3d 31 20 8c 20 4e | 75 6d 62 65 72 24 3d 22 |t%=1 . N|umber$="|
|00000890| 30 22 2b 4e 75 6d 62 65 | 72 24 0d 02 08 22 4e 75 |0"+Numbe|r$..."Nu|
|000008a0| 6d 62 65 72 24 3d c2 22 | 20 20 20 20 20 20 20 22 |mber$=."| "|
|000008b0| 2b 4e 75 6d 62 65 72 24 | 2c 31 30 29 0d 02 12 0c |+Number$|,10)....|
|000008c0| 3d 4e 75 6d 62 65 72 24 | 0d 02 1c 05 20 0d 02 26 |=Number$|.... ..&|
|000008d0| 10 f4 20 54 68 61 74 27 | 73 20 69 74 21 0d ff |.. That'|s it!.. |
+--------+-------------------------+-------------------------+--------+--------+